There are many other operations you can perform on arrays. Lets look at some of the different functions and options you have when creating and using arrays.
Setting Array Boundaries
The lower boundary of an array can be changed in one of two ways. First, you can put the Option Base statement in the (General) (Declarations) section of a module:
Option Base 1
Base may be set to either 0 or 1. Unless you have some great reason to start the array subscripts at 1, dont use this option. Just leave the subscripts to start at 0, because this is what most Visual Basic programmers expect array subscripts to start with.
You can explicitly state the boundaries of an array right in the declaration of the array using the To keyword:
Public gaintTypes(1 To 5) As Integer
Private mastrPorts(50 To 100) As String
The first statement creates an array of five integers that have indexes from 1 to 5. The second statement creates an array of strings with indexes that range from 50 to 100. Keep in mind that there are 51 elements in this array because the elements begin their numbering at 50.
TIP It is recommended that unless you need an array to exactly model something in the real world, always use zero as a base. List boxes and other items in Visual Basic use zero as a base, and your code could become confusing if you constantly have to switch between 0 and 1.